package games;

import java.util.Random;
import java.util.Vector;

import games.Cards;
import games.MoneyCard;
import games.GoCard;

public class CommunityChest extends Square{

    Vector<Cards> cards;
    
    public CommunityChest(String n){
        super(n);
        
        cards=new Vector<Cards>();
        
        Cards earnMoney=new MoneyCard(1000);
		cards.add(earnMoney);
		
		Cards earnMoney_2=new MoneyCard(2000);
		cards.add(earnMoney_2);
		
		Cards loseMoney=new MoneyCard(-1000);
		cards.add(loseMoney);
		
		Cards loseMoney_2=new MoneyCard(-2000);
		cards.add(loseMoney_2);
		
		Cards goForward= new GoCard(6);
		cards.add(goForward);
		
		Cards goForward_2= new GoCard(3);
		cards.add(goForward_2);
		
		Cards goBack= new GoCard(-6);
		cards.add(goBack);
		
		Cards goBack_2= new GoCard(-3);
		cards.add(goBack_2);
    }
    
    
    
    
    @Override
	public void onSquare(Player p) {
		Cards currentCard;
		currentCard=pickCard();
		currentCard.onPick(p);

	}




	private Cards pickCard() {
        Random rand = new Random();
        int i = (rand.nextInt(cards.size()));
		return cards.elementAt(i);
	}
    
    

}
